package com.sikaryofficial.workbench.domain.mapping;

import com.sikaryofficial.workbench.domain.dto.req.goods.CreateOrUpdateGoodsReq;
import com.sikaryofficial.workbench.domain.dto.resp.goods.GoodsDTO;
import com.sikaryofficial.workbench.domain.dto.resp.goods.GoodsManageDetailDTO;
import com.sikaryofficial.workbench.domain.dto.resp.goods.GoodsManageListDTO;
import com.sikaryofficial.workbench.domain.entity.Goods;
import com.sikaryofficial.workbench.domain.eo.GoodsEO;
import com.sikaryofficial.workbench.domain.vo.goods.GoodsProduct;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author : qinjinyuan
 * @desc : 商品实体映射
 * @date : 2023/11/03 9:19
 */
@Mapper
public interface GoodsMapping {
    GoodsMapping INSTANCE = Mappers.getMapper(GoodsMapping.class);

    /**
     * 实体映射resp
     *
     * @param goods
     * @return
     */
    GoodsDTO coverToDTO(Goods goods);

    /**
     * 实体集合映射resp
     * @param goods
     * @return
     */
    List<GoodsDTO> coverToDTOList(List<Goods> goods);
    /**
     * 实体映射product
     * @param goods
     * @return
     */
    GoodsProduct coverToProduct(GoodsDTO goods);
    /**
     *
     * @param goods
     * @return
     */
    List<GoodsProduct> coverToProductList(List<GoodsDTO> goods);

    /*------------------商品管理模块------------------*/

    GoodsManageDetailDTO covertToManageDetailDTO(Goods goods);

    GoodsManageListDTO covertToManageDTO(Goods goods);

    List<GoodsManageListDTO> covertToManageDTOList(List<Goods> goodsList);

    Goods convertToEntity(CreateOrUpdateGoodsReq req);

    Goods convertToEntityByEO(GoodsEO goodsEO);

    GoodsEO convertToEO(Goods goods);
}
